package com.yaolisheng.service;

import com.yaolisheng.pojo.SysConfig;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yaolisheng
 * @version 1.0
 * @date 2021/5/16 22:45
 */

//降级
@Component
public class SysClientserviceFallbackFactory implements FallbackFactory {
    @Override
    public Object create(Throwable throwable) {
        return new SysClientService() {
            @Override
            public List<SysConfig> queryAll() {
                SysConfig sysConfig = new SysConfig();
                        sysConfig.setSetBy("1");
                        List<SysConfig> list = new ArrayList<>();
                        list.add(sysConfig);
                return list;
            }
        };
    }
}
